<template>
<div class="pie">
  <e-charts :option="option" autoresize></e-charts>
</div>
</template>

<script>
import ECharts from 'vue-echarts'
import { use } from 'echarts/core'

// import ECharts modules manually to reduce bundle size
import {
  CanvasRenderer
} from 'echarts/renderers'
import {
  PieChart
} from 'echarts/charts'
import {
  TooltipComponent,
  TitleComponent
} from 'echarts/components'

use([
  CanvasRenderer,
  PieChart,
  TooltipComponent,
  TitleComponent
])
export default {
  components: {
    ECharts
  },
  data () {
    return {

      option: {
        title: {
          text: '就业学历分布',
          left: 'center',
          textStyle: {
            color: '#fff',
            fontSize: 35
          },
          top: '5%'
        },
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        series: [
          {
            name: '就业学历分布',
            type: 'pie',
            radius: ['40%', '70%'],
            center: ['50%', '50%'],
            roseType: 'area',
            itemStyle: {
              borderRadius: 10,
              borderColor: '#fff',
              borderWidth: 2
            },
            label: {
              show: true,
              fontSize: '20'
            },
            emphasis: {
              label: {
                show: true,
                fontSize: '40',
                fontWeight: 'bold'
              }
            },
            data: [
              { value: 45, name: '本科' },
              { value: 44, name: '大专' },
              { value: 4.1, name: '中专' },
              { value: 6.3, name: '高中' },
              { value: 0.6, name: '初中' }
            ]
          }
        ]
      }
    }
  }
}
</script>

<style scoped>

.pie {
  width: 100%;
  height: 100vh;
}

.echarts canvas {
  width: 100% !important;
}
</style>
